﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity;
using System.Data;
using System.Data.SqlClient;
using DAL;

namespace BLL
{
    public class T_BOrder
    {
        //省份
        public static List<Area> Save()
        {
            SqlDataReader dr = T_Order.Area();
            List<Area> save = new List<Area>();
            while (dr.Read())
            {
                Area a = new Area();
                a.codeID = (string)dr["codeID"];
                a.name = (string)dr["name"];
                a.parentID = (string)dr["parentID"];
                save.Add(a);
            }
            dr.Close();
            return save;
        }
        //查询市
        public static List<Area> City(string i)
        {
            SqlDataReader dr = T_Order.City(i);
            List<Area> City = new List<Area>();
            while (dr.Read())
            {
                Area a = new Area();
                a.codeID = (string)dr["codeID"];
                a.name = (string)dr["name"];
                a.parentID = (string)dr["parentID"];
                City.Add(a);
            }
            dr.Close();
            return City;
        }
        //查询县
        public static List<Area> County(string i)
        {
            SqlDataReader dr = T_Order.County(i);
            List<Area> County = new List<Area>();
            while (dr.Read())
            {
                Area a = new Area();
                a.codeID = (string)dr["codeID"];
                a.name = (string)dr["name"];
                a.parentID = (string)dr["parentID"];
                County.Add(a);
            }
            dr.Close();
            return County;
        }
        //添加地址
        public static bool AddAddress(ShoppingAddress ads)
        {
            return T_Order.AddAddress(ads);
        }
    }
}
